# Maintainer: George rawlinson <grawlinson@archlinux.org>
# Contributor: fzerorubigd <fzero@rubi.gd>

pkgname=python-cli_helpers
pkgver=2.3.0
pkgrel=2
pkgdesc='Python helpers for common CLI tasks'
arch=('any')
url='https://github.com/dbcli/cli_helpers'
license=('BSD')
depends=(
  'python'
  'python-tabulate'
  'python-configobj'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
)
checkdepends=('python-pytest')
optdepends=('python-pygments: for styles extras')
_commit='58c7d280338748a6de6317a5e7d3104b6a27b8fb'
source=("$pkgname::git+https://github.com/dbcli/cli_helpers.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  pytest -v \
    --deselect tests/tabular_output/test_tabulate_adapter.py::test_tabulate_wrapper
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
